package cn.jilian.dao;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.repository.PagingAndSortingRepository;

import cn.jilian.entity.Order;

public interface OrderDAO extends PagingAndSortingRepository<Order, Long> {

	Page<Order> findByFidAndNameContaining(Long fid,String name,Pageable pageable);
	
	
	Order findByFidAndName(Long fid,String name);
	
//	@Query("select * from Order where fid=?1 and name like ?2% and startDate>=?3 and startDate<=?4 and flag=?5")
	Page<Order> findByFidAndFlag(Long fid,Integer flag,Pageable pageable);
	
	Page<Order> findByFidAndNameContainingAndFlag(Long fid,String name,Integer flag,Pageable pageable);
	
	Page<Order> findByFidAndNameContainingAndFlagAndStartDateGreaterThanEqual(Long fid,String name,Integer flag,String date,Pageable pageable);
//	
	Page<Order> findByFidAndNameContainingAndFlagAndStartDateLessThanEqual(Long fid,String name,Integer flag,String date,Pageable pageable);
	
	
	
	Page<Order> findByFidAndFlagGreaterThanEqual(Long fid,Integer flag,Pageable pageable);
	
	Page<Order> findByFidAndFlagGreaterThanEqualAndStartDateBetween(Long fid,Integer flag,String startDate,String endDate,Pageable pageable);
	
	Page<Order> findByFidAndFlagAndStartDateGreaterThanEqual(Long fid,Integer flag,String date,Pageable pageable);
	
	Page<Order> findByFidAndFlagAndStartDateLessThanEqual(Long fid,Integer flag,String date,Pageable pageable);
	Page<Order> findByFidAndNameContainingAndFlagAndStartDateBetween(Long fid,String name,Integer flag,String startdate,String endDate,Pageable pageable);
	
//	@Query("select * from Order where fid=?1 and startDate>=?2 and startDate<=?3 and flag=?4")
	Page<Order> findByStartDateBetween(String startDate,String endDate,Pageable pageable);
//	
}
